// Fuck javascript forever!

/* 检查字符串是否都是数字 */
function checkNumber(n) {
	var re = /^[0-9]+.?[0-9]*$/;
	if (!re.test(n)) {
		return false;
	} else {
		return true;
	}
}


/* 获取本站host */
function getLocalHost() {
	var host = window.location.host;
	return "http://" + host;
}

/* 格式化日期 */
function formateDate(date) {
	var year = date.substr(0, 4);
	var month = date.substr(5, 2);
	var day = date.substr(8, 2);
	return year + "年" + month + "月" + day + "日";
}

/* First, checks if it isn't implemented yet. */
if (!String.prototype.format) {
	String.prototype.format = function() {
		var args = arguments;
		return this.replace(/{(\d+)}/g,
			function(match, number)	{
				return typeof args[number] != 'undefined' ? args[number] : match;
			});
	};
}
